#include "globalobserver.h"
#include "smsmonitor.h"

/**
 * Constructor
 * @return - NONE
 * */
CGlobalObserver:: CGlobalObserver(CEikonEnv* aEnv) 
: CActive(0), iEnv(aEnv)
{
	CActiveScheduler::Add(this);
}

/**
 * Destructor
 * @return - NONE
 * */
CGlobalObserver::~CGlobalObserver()
{
	Cancel();
}

/**
 * This function is called by the platform upon completion of an asynchronous request
 * @return - NONE
 * */
void CGlobalObserver::RunL() 
{
	SMSMonitor* monitor = SMSMonitor::GetInstance();
	if(iStatus.Int() == 3013)
	{
		monitor->OpenMsg();
	}
	monitor->SetNoteDisplayed(false);
//	// This can be utilized to handle the "exit" of the global note a little differently
//	else if(iStatus.Int() == 3009)
//	{
//		monitor->SendEvent();
//	}
}

/**
 * This function is called by the platform to cancel any asynchronous request
 * @return - NONE
 * */
void CGlobalObserver::DoCancel()
{
}

/**
 * This function issues the initial request
 * @return - NONE
 * */
void CGlobalObserver::Start()
{
	SetActive();
}
